<HTML>
  <HEAD>
     <SCRIPT>
      var Request = function()
      {
          this.getParameter = function( name )
          {
              var rtnval = '';
              var nowAddress = unescape(location.href);
              var parameters = (nowAddress.slice(nowAddress.indexOf('?')+1,nowAddress.length)).split('&');
              for(var i = 0 ; i < parameters.length ; i++)
              {
                  var varName = parameters[i].split('=')[0];
                  if(varName.toUpperCase() == name.toUpperCase())
                  {
                      rtnval = parameters[i].split('=')[1];
                      break;
                  }
              }
              return rtnval;
          }
      }
      
      var request = new Request();
        var xmlhttp;
        function getData(){
          if (window.XMLHttpRequest){
            xmlhttp = new XMLHttpRequest();
          }
          else{
            xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
          }
          
          if (xmlhttp == null) return;
          
          var url = "query.php?pid=" + request.getParameter('id');
          
          xmlhttp.onreadystatechange = function(){
              if(xmlhttp.readyState == 4) {
                var spdata = xmlhttp.responseText;
                document.getElementById("DATA").innerHTML = spdata;
              }
           };
          xmlhttp.open("GET", url, true);
          xmlhttp.send('');
        }
        
        function timer(){
          window.setInterval('getData()',5000);
        
        }
    </SCRIPT>
  </HEAD>
  <BODY onload="timer()">
    <DIV ID="DATA"></DIV>
  </BODY>
</HTML>
